/**
 * @Author: 雷◕‿◕宇
 * @Description: 继承中的构造方法
 * @Date: 2018/10/30
 */

void main() {
  var student = new Student("Tom", "Male");

  print(student.name);
}

class Person {
  String? name;
  int? age;

  Person(String name) : this._internal(name, 10);

  //构造函数的重定向
  Person._internal(this.name, this.age);

  Person.withName(this.name);
}

class Student extends Person {
  int? age;

  final String gender;

  Student(String name, String g)
      : gender = g,
        super.withName(name);
}
